package main

import (
	"fmt"
	"os"
	"net/http"
)

func main() {
	if len(os.Args) <2 {
		fmt.Errorf("Usage: http-head <url>")
		os.Exit(1)
	}

	url:=os.Args[1]

	res,err:=http.Head(url);
	if err!=nil {
		fmt.Errorf("%v\n", err)
		os.Exit(2)
	} else {
		fmt.Println(res.Proto, res.Status)
		for key,values := range res.Header {
			for _,value := range values {
				fmt.Printf("%s: %s\n", key, value)
			}
		}

		fmt.Println()
	}
}
